<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateGoodsAttrsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('goods_attrs', function (Blueprint $table) {
            $table->increments('id');
            $table->integer('goods_id');
            $table->string('type')->default('RADIO');  //属性类型 RADIO, INPUT ... 可扩展
            $table->string('name');
            $table->string('values')->nullable();      // 属性可选值，json格式存储
            $table->string('prices')->nullable();      // 属性价格，json格式存储，和values一一对应
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('goods_attrs');
    }
}
